﻿<%@ Page Title="" Language="C#" MasterPageFile="Registration.master" AutoEventWireup="true" CodeFile="StudentRegistration.aspx.cs" Inherits="StudentRegistration" %>
<%@ Register Assembly="MSCaptcha" Namespace="MSCaptcha" TagPrefix="cc4" %>
<%@ Register Assembly="WebCaptchaControl_AJAX" Namespace="WebCaptchaControl_AJAX" TagPrefix="cc2" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/common.js"></script>
<script type="text/javascript"> 

    function CheckUserName(val) {
        var username = document.getElementById('<%=hdnValidUserName.ClientID %>');
        username.value = 'false';
        if (val != '') {
            var text = { "UserName": val };
            $.ajax({
                type: "POST",
                url: "WebService/Validations.asmx/CheckUserName",
                data: JSON.stringify(text),
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (msg) {
                    if (msg.d != '') {
                        if (msg.d == 'True') {
                            username.value = 'false';
                            $('#divMessage').attr('style', 'color:red');
                            $('#divMessage').html('This User Name already exists');
                            return 'false';
                        }
                        else {
                            username.value = 'true';
                            $('#divMessage').attr('style', 'color:Green');
                            $('#divMessage').html('ok');
                            return 'true';
                        }
                    }
                }
            });
        }
        else {
            $('#divMessage').attr('style', 'color:red');
            $('#divMessage').html('User name can not be blank.');
            username.value = 'false';
            return 'false';
        }
        return 'true';
    }



    function CheckEmail(val) {
        var hdnemail = document.getElementById('<%=hdnValidEmail.ClientID %>');
        hdnemail.value = 'false';
        var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
        if (val != '') {
            if (reg.test(val) == false) {
                $('#divEmailMessage').attr('style', 'color:red');
                $('#divEmailMessage').html('Please Enter valid Email');
            }
            else {
                var text = { "Email": val };
                $.ajax({
                    type: "POST",
                    url: "WebService/Validations.asmx/CheckEmail",
                    data: JSON.stringify(text),
                    contentType: "application/json; charset=utf-8",
                    dataType: "json",
                    success: function (msg) {
                        if (msg.d == 'True') {
                            hdnemail.value = 'false';
                            $('#divEmailMessage').attr('style', 'color:red');
                            $('#divEmailMessage').html('This Email already exists');
                            return 'false';
                        }
                        else {
                            hdnemail.value = 'true';
                            $('#divEmailMessage').attr('style', 'color:Green');
                            $('#divEmailMessage').html('ok');
                            return 'true';
                        }
                    }
                });
            }
        }
        else {
            $('#divEmailMessage').attr('style', 'color:red');
            $('#divEmailMessage').html('Email can not be blank.');
            hdnemail.value = 'false';
            return 'false';
        }
        return 'true';
    }
    function validate() { 
        var email = document.getElementById('<%=txtEmail.ClientID %>').value; 
        var result = CheckEmail(email);
        if (result == 'true')
            return true;
        else return false;
    }
</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">

<asp:HiddenField ID="hdnValidEmail" runat="server" />
<asp:HiddenField ID="hdnValidUserName" runat="server" /> 


<asp:UpdatePanel ID="upMain" runat="server"  UpdateMode="Conditional" ><ContentTemplate>

<section>


<p>Fill out the form to contact us today!</p>
<p class="ar">* Field required</p>

<form id="" name="">
	<div class="inputbardiv">
		<label for="name" class="input_text">First Name: *</label>
                <asp:TextBox ID="txtFirstName"  class="input_field"  onblur="javaScript: if (this.value=='') {this.value='eg : John';}" onfocus="javaScript: if (this.value=='eg : John') {this.value='';}"  runat="server"></asp:TextBox>
	</div>   
    
    <div class="inputbardiv">
		<label for="name" class="input_text">Last Name: *</label>
         <asp:TextBox ID="txtLastName" runat="server" class="input_field" onblur="javaScript: if (this.value=='') {this.value='eg : Smith';}"
                 onfocus="javaScript: if (this.value=='eg : Smith') {this.value='';}" ></asp:TextBox>
	</div> 
    
    <div class="inputbardiv">
		<label for="name" class="input_text">Email : *</label> 
                <asp:TextBox ID="txtEmail" onblur="CheckEmail(this.value);"  class="input_field" onclick="javaScript: if (this.value=='eg : john.smith@gmail.com') {this.value='';}"
                 runat="server" ></asp:TextBox>
               <label id="divEmailMessage" style="text-align:left;" class="hiddentext"></label>

	</div> 
    
    <div class="inputbardiv">
		<label for="name" class="input_text">Password : *</label>
                <asp:TextBox ID="txtPassword" class="input_field"  runat="server" 
                 TextMode="Password"></asp:TextBox>
                <label  style="text-align:left;color:#ADADAD;font-weight:normal;" >Min. 6 characters </label>
	</div> 
    
    <div class="inputbardiv">
		<label for="name" class="input_text">Confirm Password : *</label>
		
                <asp:TextBox ID="txtConfirmPassword" class="input_field"  
                 runat="server"  TextMode="Password"></asp:TextBox>
	</div> 
    
    <div class="inputbardiv">
		<label for="name" class="input_text">Mobile No : *</label>
        
                <asp:TextBox ID="txtMobileNo" class="input_field"   onkeypress="return fnNumeric(event);" MaxLength="10"
                 runat="server"></asp:TextBox>
                <label  style="text-align:left;color:#ADADAD;font-weight:normal;" >Don't Prefix 91 or 0 </label>
	</div> 
    <div class="inoutbardiv">
    
		<label for="name" class="input_text">Mobile No : *</label>
        
                <asp:TextBox ID="TextBox1" class="input_field"   onkeypress="return fnNumeric(event);" MaxLength="10"
                 runat="server"></asp:TextBox>
                <label  style="text-align:left;color:#ADADAD;font-weight:normal;" >Don't Prefix 91 or 0 </label>
    </div>
    
<div class="allsubmitbutton">
  	<button id="sbm" type="submit" value="Create Account" class="submitbuttons">Submit</button>    
    <div class="iconbg star_icon shadow_bound"></div>
                <asp:Label ID="lblError" ForeColor="Red" runat="server" EnableViewState="false"></asp:Label> 
<asp:ValidationSummary ID="ValidationSummary1" runat="server" DisplayMode="SingleParagraph" CssClass="red11" />
  <asp:UpdateProgress ID="upgroress1" runat="server"  AssociatedUpdatePanelID="upMain">
<ProgressTemplate>
<img src="images/slider-progress-bar.gif" width="125px" height="125px" alt="" class="imgprogress"/>
</ProgressTemplate>
</asp:UpdateProgress>
</div> 
    
</form>


</section>
<!--End section-->
</ContentTemplate></asp:UpdatePanel>


</asp:Content>

